﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace LyyCMS.Migrations
{
    public partial class newinit : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<int>(
                name: "ChannelId",
                table: "ArticleCategory",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<string>(
                name: "SEODescription",
                table: "ArticleCategory",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "SEOKey",
                table: "ArticleCategory",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "SEOTitle",
                table: "ArticleCategory",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "SEODescription",
                table: "Article",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "SEOKey",
                table: "Article",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "SEOTitle",
                table: "Article",
                nullable: true);

            migrationBuilder.CreateTable(
                name: "Site",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    SiteName = table.Column<string>(nullable: false),
                    SiteType = table.Column<int>(nullable: false),
                    IsEnabled = table.Column<bool>(type: "bit", nullable: false),
                    IsDefault = table.Column<bool>(type: "bit", nullable: true),
                    SortId = table.Column<int>(nullable: false),
                    Name = table.Column<string>(nullable: false),
                    Logo = table.Column<string>(nullable: true),
                    CompanyAddress = table.Column<string>(nullable: true),
                    Phone = table.Column<string>(nullable: true),
                    Tex = table.Column<string>(nullable: true),
                    Email = table.Column<string>(nullable: true),
                    Record = table.Column<string>(nullable: true),
                    CopyRight = table.Column<string>(nullable: true),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    DeleterUserId = table.Column<long>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Site", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "Channels",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Title = table.Column<string>(maxLength: 10, nullable: false),
                    UseName = table.Column<string>(nullable: true),
                    IsEnabled = table.Column<bool>(type: "bit", nullable: false),
                    IsComment = table.Column<bool>(type: "bit", nullable: false),
                    IsPics = table.Column<bool>(type: "bit", nullable: false),
                    IsAnnex = table.Column<bool>(type: "bit", nullable: false),
                    SortId = table.Column<int>(nullable: false),
                    SiteId = table.Column<int>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    DeleterUserId = table.Column<long>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Channels", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Channels_Site_SiteId",
                        column: x => x.SiteId,
                        principalTable: "Site",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.UpdateData(
                table: "Blogs",
                keyColumn: "Id",
                keyValue: 1,
                column: "Create_At",
                value: new DateTime(2019, 10, 24, 11, 50, 34, 854, DateTimeKind.Local).AddTicks(5434));

            migrationBuilder.UpdateData(
                table: "Blogs",
                keyColumn: "Id",
                keyValue: 2,
                column: "Create_At",
                value: new DateTime(2019, 10, 24, 11, 50, 34, 854, DateTimeKind.Local).AddTicks(5434));

            migrationBuilder.UpdateData(
                table: "Comments",
                keyColumn: "Id",
                keyValue: 1,
                column: "Create_At",
                value: new DateTime(2019, 10, 24, 11, 50, 34, 855, DateTimeKind.Local).AddTicks(5434));

            migrationBuilder.UpdateData(
                table: "Comments",
                keyColumn: "Id",
                keyValue: 2,
                column: "Create_At",
                value: new DateTime(2019, 10, 24, 11, 50, 34, 855, DateTimeKind.Local).AddTicks(5434));

            migrationBuilder.UpdateData(
                table: "Comments",
                keyColumn: "Id",
                keyValue: 3,
                column: "Create_At",
                value: new DateTime(2019, 10, 24, 11, 50, 34, 855, DateTimeKind.Local).AddTicks(5434));

            migrationBuilder.UpdateData(
                table: "Comments",
                keyColumn: "Id",
                keyValue: 4,
                column: "Create_At",
                value: new DateTime(2019, 10, 24, 11, 50, 34, 855, DateTimeKind.Local).AddTicks(5434));

            migrationBuilder.InsertData(
                table: "Site",
                columns: new[] { "Id", "CompanyAddress", "CopyRight", "CreationTime", "CreatorUserId", "DeleterUserId", "DeletionTime", "Email", "IsDefault", "IsDeleted", "IsEnabled", "LastModificationTime", "LastModifierUserId", "Logo", "Name", "Phone", "Record", "SiteName", "SiteType", "SortId", "Tex" },
                values: new object[] { 1, "公司地址", "@版权所有", new DateTime(2019, 10, 24, 11, 50, 34, 846, DateTimeKind.Local).AddTicks(5429), 1L, 0L, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "10000@qq.com", true, false, true, null, null, "", "默认站点", "", "", "默认站点", 0, 1, "" });

            migrationBuilder.UpdateData(
                table: "Users",
                keyColumn: "Id",
                keyValue: 1,
                column: "Crete_At",
                value: new DateTime(2019, 10, 24, 11, 50, 34, 853, DateTimeKind.Local).AddTicks(5433));

            migrationBuilder.InsertData(
                table: "Channels",
                columns: new[] { "Id", "CreationTime", "CreatorUserId", "DeleterUserId", "DeletionTime", "IsAnnex", "IsComment", "IsDeleted", "IsEnabled", "IsPics", "LastModificationTime", "LastModifierUserId", "SiteId", "SortId", "Title", "UseName" },
                values: new object[,]
                {
                    { 1, new DateTime(2019, 10, 24, 11, 50, 34, 850, DateTimeKind.Local).AddTicks(5431), 1L, 0L, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), false, false, false, true, false, null, null, 1, 1, "新闻资讯", "" },
                    { 2, new DateTime(2019, 10, 24, 11, 50, 34, 851, DateTimeKind.Local).AddTicks(5432), 1L, 0L, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), false, false, false, true, false, null, null, 1, 2, "购物商城", "" },
                    { 3, new DateTime(2019, 10, 24, 11, 50, 34, 851, DateTimeKind.Local).AddTicks(5432), 1L, 0L, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), false, false, false, true, false, null, null, 1, 3, "视频专区", "" },
                    { 4, new DateTime(2019, 10, 24, 11, 50, 34, 851, DateTimeKind.Local).AddTicks(5432), 1L, 0L, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), false, false, false, true, false, null, null, 1, 4, "图片分享", "" },
                    { 5, new DateTime(2019, 10, 24, 11, 50, 34, 851, DateTimeKind.Local).AddTicks(5432), 1L, 0L, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), false, false, false, true, false, null, null, 1, 5, "资源下载", "" },
                    { 6, new DateTime(2019, 10, 24, 11, 50, 34, 851, DateTimeKind.Local).AddTicks(5432), 1L, 0L, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), false, false, false, true, false, null, null, 1, 6, "公司介绍", "" }
                });

            migrationBuilder.CreateIndex(
                name: "IX_ArticleCategory_ChannelId",
                table: "ArticleCategory",
                column: "ChannelId");

            migrationBuilder.CreateIndex(
                name: "IX_Channels_SiteId",
                table: "Channels",
                column: "SiteId");

            migrationBuilder.AddForeignKey(
                name: "FK_ArticleCategory_Channels_ChannelId",
                table: "ArticleCategory",
                column: "ChannelId",
                principalTable: "Channels",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_ArticleCategory_Channels_ChannelId",
                table: "ArticleCategory");

            migrationBuilder.DropTable(
                name: "Channels");

            migrationBuilder.DropTable(
                name: "Site");

            migrationBuilder.DropIndex(
                name: "IX_ArticleCategory_ChannelId",
                table: "ArticleCategory");

            migrationBuilder.DropColumn(
                name: "ChannelId",
                table: "ArticleCategory");

            migrationBuilder.DropColumn(
                name: "SEODescription",
                table: "ArticleCategory");

            migrationBuilder.DropColumn(
                name: "SEOKey",
                table: "ArticleCategory");

            migrationBuilder.DropColumn(
                name: "SEOTitle",
                table: "ArticleCategory");

            migrationBuilder.DropColumn(
                name: "SEODescription",
                table: "Article");

            migrationBuilder.DropColumn(
                name: "SEOKey",
                table: "Article");

            migrationBuilder.DropColumn(
                name: "SEOTitle",
                table: "Article");

            migrationBuilder.UpdateData(
                table: "Blogs",
                keyColumn: "Id",
                keyValue: 1,
                column: "Create_At",
                value: new DateTime(2019, 10, 22, 11, 25, 21, 401, DateTimeKind.Local).AddTicks(9022));

            migrationBuilder.UpdateData(
                table: "Blogs",
                keyColumn: "Id",
                keyValue: 2,
                column: "Create_At",
                value: new DateTime(2019, 10, 22, 11, 25, 21, 401, DateTimeKind.Local).AddTicks(9022));

            migrationBuilder.UpdateData(
                table: "Comments",
                keyColumn: "Id",
                keyValue: 1,
                column: "Create_At",
                value: new DateTime(2019, 10, 22, 11, 25, 21, 401, DateTimeKind.Local).AddTicks(9022));

            migrationBuilder.UpdateData(
                table: "Comments",
                keyColumn: "Id",
                keyValue: 2,
                column: "Create_At",
                value: new DateTime(2019, 10, 22, 11, 25, 21, 402, DateTimeKind.Local).AddTicks(9022));

            migrationBuilder.UpdateData(
                table: "Comments",
                keyColumn: "Id",
                keyValue: 3,
                column: "Create_At",
                value: new DateTime(2019, 10, 22, 11, 25, 21, 402, DateTimeKind.Local).AddTicks(9022));

            migrationBuilder.UpdateData(
                table: "Comments",
                keyColumn: "Id",
                keyValue: 4,
                column: "Create_At",
                value: new DateTime(2019, 10, 22, 11, 25, 21, 402, DateTimeKind.Local).AddTicks(9022));

            migrationBuilder.UpdateData(
                table: "Users",
                keyColumn: "Id",
                keyValue: 1,
                column: "Crete_At",
                value: new DateTime(2019, 10, 22, 11, 25, 21, 398, DateTimeKind.Local).AddTicks(9020));
        }
    }
}
